<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script type="text/javascript">
        var t = 10;
        function changeUrl() {
            document.getElementById('d1').innerHTML="当前剩余时间为:"+t+"s";
            t--;
            if(t==-1){
                window.location="https://www.baidu.com";
            }
        }

        function setResidue(){
            changeUrl();
            window.setInterval("setResidue()",1000);
        }
    </script>
</head>
<body onload="setResidue()">
<div id="d1"></div>
</body>
</html>